Nested VMX: Lazy FPU for n2 guest
authorEddie Dong <eddie.dong@intel.com>
Thu, 9 Jun 2011 08:24:09 +0000 (16:24 +0800)
committerEddie Dong <eddie.dong@intel.com>
Thu, 9 Jun 2011 08:24:09 +0000 (16:24 +0800)
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/arch/x86/hvm/vmx/vvmx.c

index 87ceef3f1f106de278b17dc188a40c07d30017db..eca653f2a0f68001353dd1b6c3474f87ae072067 100644 (file)
@@ -810,6 +810,9 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
 
+    /* updating host cr0 to sync TS bit */
+    __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
+
     /* TODO: EPT_POINTER */
 }
 
@@ -958,6 +961,9 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     regs->esp = __get_vvmcs(nvcpu->nv_vvmcx, HOST_RSP);
     regs->eflags = __vmread(GUEST_RFLAGS);
 
+    /* updating host cr0 to sync TS bit */
+    __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
+
     vmreturn(regs, VMSUCCEED);
 }
 
@@ -1306,13 +1312,18 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
 
         /*
          * decided by L0 and L1 exception bitmap, if the vetor is set by
-         * both, L0 has priority on #PF, L1 has priority on others
+         * both, L0 has priority on #PF and #NM, L1 has priority on others
          */
         if ( vector == TRAP_page_fault )
         {
             if ( paging_mode_hap(v->domain) )
                 nvcpu->nv_vmexit_pending = 1;
         }
+        else if ( vector == TRAP_no_device )
+        {
+            if ( v->fpu_dirtied )
+                nvcpu->nv_vmexit_pending = 1;
+        }
         else if ( (intr_info & valid_mask) == valid_mask )
         {
             exec_bitmap =__get_vvmcs(nvcpu->nv_vvmcx, EXCEPTION_BITMAP);